<template>
	<view
		style="background: white;border-radius: 12rpx;margin-top: 15rpx;padding: 15rpx 15rpx 6rpx 15rpx;display: flex;flex-direction: column;">
		<view v-if="item.type == 'text'" style="width: 100%;display: flex;justify-content: space-between;">
			<view class="">
				{{item.content}}
			</view>
			<view @click="handleClick" class="" v-if="choose">
				<image style="width: 40rpx;height: 40rpx;" src="/static/images/check.png" mode=""></image>
			</view>
		</view>
		<view v-if="item.type == 'image'" style="width: 100%;display: flex;justify-content: space-between;">
			<image @click="showbigimg($store.state.common.systemInfo.fileurl + item.content)" style="width: 200rpx;" :src="$store.state.common.systemInfo.fileurl + item.content" mode="widthFix"></image>
			<view @click="handleClick" class="" v-if="choose">
				<image style="width: 40rpx;height: 40rpx;" src="/static/images/check.png" mode=""></image>
			</view>
		</view>
		<view v-if="item.type == 'video'" style="width: 100%;display: flex;justify-content: space-between;">
			<bgyx-collect-video :info="item" />
			<view @click="handleClick" class="" v-if="choose">
				<image style="width: 40rpx;height: 40rpx;" src="/static/images/check.png" mode=""></image>
			</view>
		</view>
		<view v-if="item.type == 'audio'" style="width: 100%;display: flex;justify-content: space-between;">
			<bgyx-collect-voice :info="item" />
			<view @click="handleClick" class="" v-if="choose">
				<image style="width: 40rpx;height: 40rpx;" src="/static/images/check.png" mode=""></image>
			</view>
		</view>
		<view v-if="item.type == 'file'" style="width: 100%;display: flex;justify-content: space-between;">
			<bgyx-collect-file :info="item" />
			<view @click="handleClick" class="" v-if="choose">
				<image style="width: 40rpx;height: 40rpx;" src="/static/images/check.png" mode=""></image>
			</view>
		</view>
		<view style="width: 100%;display: flex;justify-content: space-between;margin-top: 10rpx;border-top: 1rpx solid #f1f1f1;padding-top: 6rpx;">
			<view style="font-size: 20rpx;color: #cbcbcb;">
				{{item.name}}
			</view>
			<view style="font-size: 20rpx;color: #cbcbcb;">
				{{$u.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss')}}
			</view>
		</view>
	</view>
</template>

<script>
import { pub } from '../../../common/event'
	export default {
		data(){
			return {}
		},
		props:{
			item:{
				type:Object,
				default:()=>{
					return {}
				}
			},
			choose:{
				type:Boolean,
				default:true
			}
		},
		methods:{
			showbigimg:(e)=>{
				uni.previewImage({
					urls:[e]
				})
			},
			handleClick:function(){
				const data = JSON.parse(JSON.stringify(this.item))
				delete data.cid
				delete data.ctime
				delete data.id
				pub("sendcollect",data)
			}
		}
	}
</script>

<style>
</style>